package com.example.administrator.basepro.ui.presenter;

import com.blankj.utilcode.util.LogUtils;
import com.example.administrator.basepro.base.RxPresenter;
import com.example.administrator.basepro.model.DataManager;
import com.example.administrator.basepro.model.bean.TableBean;
import com.example.administrator.basepro.model.bean.TableOpeBean;
import com.example.administrator.basepro.model.bean.TableOpeBeanData;
import com.example.administrator.basepro.ui.contract.SecureShowContract;
import com.example.administrator.basepro.utils.RxUtil;

import javax.inject.Inject;

import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;

/**
 * Created by Administrator on 2017/9/1 0001.
 */

public class SecureShowPresenter extends RxPresenter<SecureShowContract.View> implements SecureShowContract.Presenter {
    private DataManager mDataManager;

    @Inject
    public SecureShowPresenter(DataManager mDataManager) {
        this.mDataManager = mDataManager;
    }

    @Override
    public void getSecureInfo() {
        addSubscribe(mDataManager.getSecureInfo().compose(RxUtil.<TableBean>rxSchedulerHelper())
        .subscribe(new Consumer<TableBean>() {
            @Override
            public void accept(@NonNull TableBean bean) throws Exception {
                mView.showSecureInfo(bean);
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(@NonNull Throwable throwable) throws Exception {
            }
        }));
    }
}
